<?php
    class Xs_feed extends CActiveRecord
    {
        
        public static function countAll()
        {
            $connect = Yii::app()->db;
            $sql = "SELECT * FROM xs_feed";
            $command = Yii::app()->db->createCommand($sql);
            $sql1 = "SELECT COUNT(id) FROM xs_feed";
            $data = $command->execute();
            return $data;
        }
        
        public static function getData()
        {
            $connect = Yii::app()->db;
            $sql = "SELECT * FROM xs_feed";
            $command = Yii::app()->db->createCommand($sql);
            $data = $command->queryAll();
            return $data;
        }
        
        public static function nextData($id)
        {
            $connect = Yii::app()->db;
            $sql = "SELECT * FROM xs_feed WHERE id=$id";
            $command = Yii::app()->db->createCommand($sql);
            $data = $command->queryRow();
            return $data;
        }
        
    }
?>
